const db = wx.cloud.database();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    articleList:null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let name = options.name;
    let category = parseInt(options.category);

    //改变标题title
    wx.setNavigationBarTitle({
      title: options.name,
    });

    let that = this;
    var filter = {category: category};

    wx.showLoading({
      icon: 'none',
      title: '加载中'
    });
    wx.cloud.callFunction({
      name: 'pagination',
      data: {
        dbName: 'article_list',
        pageIndex:1,
        pageSize: 100,
        filter: filter
      },
      success(res) {
        wx.hideLoading();
        that.setData({
          articleList: res.result.data
        });
      },
      fail() {
        wx.hideLoading();
      }
    });
  },
  onShareAppMessage: function () {

  }
})